﻿using Microsoft.Practices.Unity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vroom.TableListener.ViewModel;
using Vroom.TableListener.Views;

namespace Vroom.TableListener.Container
{
	public class TypeContainer
	{
		private static IUnityContainer _container = null;

		public static void Register()
		{
			if (_container == null) { var regs = TypeContainer.Instance.Registrations; }

			_container.RegisterTypes(
						   AllClasses.FromLoadedAssemblies(),
						   WithMappings.FromMatchingInterface,
						   WithName.Default);
		}


		public static IUnityContainer Instance
		{
			get
			{
				if (_container == null)
					_container = new UnityContainer();

				return _container;
			}
		}

	}
}
